define(function(require, exports, module) {
	var tree = require('treehugger/tree');

	/** Generic accept function */
	tree.Node.prototype.accept = function() {
		var visitor = arguments[0];
		if( typeof(this.value) != 'undefined' ) 
			visitor.visitValue(this, arguments);
		else
			throw "All nodes must be subclassed";
	}

	tree.ConsNode.prototype.accept = function() {
		var visitor = arguments[0];

		if( typeof(visitor['visitCons'+this.cons]) != 'function' ) throw "Visitor visitCons"+this.cons+" is not defined";
		visitor['visitCons'+this.cons](this, arguments);
	}

	tree.ListNode.prototype.accept = function() {
		var visitor = arguments[0];
		visitor.visitListNode(this, arguments);
	}

	tree.NumNode.prototype.accept = function() {
		var visitor = arguments[0];
		visitor.visitNumNode(this, arguments);
	}

	tree.NumNode.prototype.accept = function() {
		var visitor = arguments[0];
		visitor.visitStringNode(this, arguments);
	}

	tree.PlaceholderNode.prototype.accept = function() {
		var visitor = arguments[0];
		visitor.visitPlaceholderNode(this, arguments);
	}
});